package com.guchenbo.example.serialize;

import java.io.IOException;

public class SerializeDemo {
    public static void main(String[] args) throws IOException {
        // 创建一个对象
        Person originalObject = new Person();
        originalObject.setName("jay");
        originalObject.setAge(18);

        // 使用 Hessian 2 序列化对象
        byte[] serializedData = Hessian2Serializer.serialize(originalObject);

        // 使用 Hessian 2 反序列化对象
        Person deserializedObject = Hessian2Serializer.deserialize(serializedData, Person.class);

        // 输出结果
        System.out.println("Original Object: " + originalObject);
        System.out.println("Deserialized Object: " + deserializedObject);

    }
}
